﻿<!DOCTYPE html>
<html>
<head>
<title>Shop Online</title>
<?php 
	session_start();
	include '../views/_meta.php';
	include '../models/Customer.php';
	require_once '../models/_check.php';
	if(isset($_POST['btn_submit'])){
	$customerID=$_SESSION["session_customer_id"];
	$f_name=$_POST["f_name"];
	$l_name=$_POST["l_name"];
	$email=$_POST["email"];
	$phone=$_POST["phone"];
	$address=$_POST["address"];
	$city=$_POST["city"];
			//Dang ky user moi
			$re=Customer::updateCustomer_add($customerID,$f_name,$l_name,$email,$phone,$address,$city);
			if($re){
				$page="address.php";
				//$_SESSION['msg']="Cập nhật thông tin thành công.";
				//$page="success.php";
				Customer::redirectTo($page);
				
			}else{
			echo "	<script type='text/javascript'>
                               $(document).ready(function() {
								showNotification({
                                        type : 'error',
                                        message: 'Cập nhật thông tin thất bại.'
                                    });
							 })                            
                            </script>";}
}
?>
</head>
<body>
<form method="post" action="">
	<div id="firstLine">
		<div id="top-bar">
		<?php include '../views/_top_bar.php';?>
		</div>
	</div>
	<div id="container">
		<div id="header">
			<?php include '../views/_head.php';?>
		</div>
		<?php include '_menu_head.php';?>
		<div id="center">
			<div id="menu-left">
				<?php include '_menu_cart_customer.php';?>
			</div>
			
			<div id="table">
					<table id="table-customer">
						<tr>
							<th colspan="2">Địa chỉ giao dịch</th>
						</tr>
						<tr>
							<td>Họ và tên:</td>
							<td><input type="text" id="f_name" name="f_name" class="input_text_w150_h30" value='<?php echo $row['f_name'];?>'>
							<input type="text" id="l_name" name="l_name" class="input_text_w150_h30" value='<?php echo $row['l_name'];?>'></td>
							<td></td>
						</tr>

						<tr>
							<td>Email:</td>
							<td><input type="text" id="email" name="email" class="input_text_w300_h30" value='<?php echo $row['email'] ?>'></td>
							<td></td>
						</tr>
						<tr>
							<td>Điện thoại:</td>
							<td><input type="text" id="phone" name="phone" class="input_text_w300_h30" value='<?php echo $row['phone']?>'></td>
							<td></td>
						</tr>
						<tr>
							<td>Địa chỉ nhận hàng:</td>
							<td><input type="text" id="address" name="address" class="input_text_w300_h30" value='<?php echo $row['address']?>'></td>
							<td></td>
						</tr>
						<tr>
							<td>Thành phố:</td>
							<td><input type="text" id="city" name="city" class="input_text_w300_h30" value='<?php echo $row['city']?>'></td>
							<td></td>
						</tr>
					</table>
					<div id='float_right'><a href='payment.php'><input type='button' name='btn_submit' class='btn_button_' value='Bước tiếp theo'></a></div>
					<div id='float_right'><input type='submit' name='btn_submit' class='btn_button_' value='Cập nhật'></div>
					<div id='float_left'><a href='cart.php'><input type='button' class='btn_button_' value='Quay lại'></a></div>
					
			</div>
			
			<div id="menu-left">
				<?php include '_menu_left.php';?>
			</div>
			</div>

		</div>

	</div>
	<div id="footer">
		<?php include '../views/_footer.php';?>
	</div>
</form>
</body>
</html>